Section Locks

So I have had a hard time finding information on handling section locks through DXL. I currently have a few modules setup for shareable edit, but I have a trigger that needs access to other modules to create links (I can't do it from the current module otherwise users will delete things and bad things happen). However, multiple people can be in a module at a given time, its also possible someone accidentally has the module open in exclusive edit.

As such, i have the trigger tell the user who needs the link created that the link wasn't created if the lock fails. I already figured out how to do basic section locking, but the problem lies in the fact that if I have both modules open in exclusive edit, the trigger yells at me because it can't lock the section. I need to find a way to return the user who has the lock and compare the username with the current users username. Or some better method that will allow the links to be deleted/created, but won't just silently fail if someone has the lock.
 

for blnk in obj1<-sLinkMod do {
    obj2=source(blnk)
        mess=lock(obj2)
        if(null mess) {delete blnk}
}
flushDeletions
unlockSaveAll(meta)
for obj in blCOTS do {
        if (obj.\"Absolute Number\"\"\" == reqID){
                blProdFound = true
                for alnk in obj->sblmetaLink do {
                        obj2=target(alnk)
                        string mess=lock(obj2)
                        if(!null(obj2)&&(null mess)) {
                                blnk=obj1<-sLinkMod<-obj2
                                unlockSaveSection(obj2)
                        }
                        else {
                                errorBox(\"The required section in the Module is already locked by another user.\\nContact Administrator.\")}
                }
                break
        }
}

SystemAdmin - Thu Sep 08 14:20:37 EDT 2011